<?php

class module_u_favorite extends a_base_module implements i_hook_pre_controller, i_hook_post_controller, i_hook_post_controller_constructor, i_hook_post_system, i_hook_base_controller_constructor {
    const DEFAULT_LIST_NAME = 'default';

    public function __construct($basic_info) {
        parent::__construct($basic_info);
    }

    public function exe_pre_controller() {
        Module_Extended::load_helper("favorite", "favorite");
        $srv = new service_l_favorite();
        static $default_fav_list = NULL;
        $user = get_logged_user();
        if ($user) {
            if ($default_fav_list === NULL) {
                $default_fav_list = $srv->get_default_or_create_fav_list($user);
                //logger::i()->info("User fav is loaded");
            }
            get_instance()->smarty_wrapper->assign("favorite", $default_fav_list);                        
        }
    }

    public function exe_post_controller() {

        // trace();
    }

    public function exe_post_controller_constructor() {

    }

    public function exe_post_system() {
        // trace();
    }

    public function exe_base_controller_constructor() {
        
    }

}